<?php

for ($i = 0; $i < $_GET['num']; $i++) {

    $path = "photo/$i.jpg";
    $data[$i]['img'] = getzoomsize($path, 190);
    $data[$i]['content'] = '这是一串测试数据';
    $data[$i]['path'] = $path;
}
echo json_encode($data);

//var_dump($data);
function myrename() {
    $name = glob("./photo/*.jpg"); //遍历目录
    foreach ($name as $key => $value) {
    rename("$value", "photo/$key.jpg");
        # code...
    }
}
//根据宽度获取缩放高度
function getzoomsize($path, $width) {



    $size = getimagesize("$path");
    $height = intval(floor(($width / $size[0]) * $size[1]));
    $newsize[0] = $width;
    $newsize[1] = $height;
    return $newsize;
}


?>